home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / amyboard / xboard-3.3.pl0 / common.h < prev    next >
C/C++ Source or Header  |  1995-08-12  |  8KB  |  248 lines

  1. /*
  2.  * common.h -- Common definitions for X and Windows NT versions of XBoard
  3.  * $Id: common.h,v 1.29 1995/07/28 05:23:42 mann Exp $
  4.  *
  5.  * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
  6.  * Enhancements Copyright 1992-95 Free Software Foundation, Inc.
  7.  *
  8.  * The following terms apply to Digital Equipment Corporation's copyright
  9.  * interest in XBoard:
  10.  * ------------------------------------------------------------------------
  11.  * All Rights Reserved
  12.  *
  13.  * Permission to use, copy, modify, and distribute this software and its
  14.  * documentation for any purpose and without fee is hereby granted,
  15.  * provided that the above copyright notice appear in all copies and that
  16.  * both that copyright notice and this permission notice appear in
  17.  * supporting documentation, and that the name of Digital not be
  18.  * used in advertising or publicity pertaining to distribution of the
  19.  * software without specific, written prior permission.
  20.  *
  21.  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  22.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  23.  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  24.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  25.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  26.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  27.  * SOFTWARE.
  28.  * ------------------------------------------------------------------------
  29.  *
  30.  * The following terms apply to the enhanced version of XBoard distributed
  31.  * by the Free Software Foundation:
  32.  * ------------------------------------------------------------------------
  33.  * This program is free software; you can redistribute it and/or modify
  34.  * it under the terms of the GNU General Public License as published by
  35.  * the Free Software Foundation; either version 2 of the License, or
  36.  * (at your option) any later version.
  37.  *
  38.  * This program is distributed in the hope that it will be useful,
  39.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  40.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  41.  * GNU General Public License for more details.
  42.  *
  43.  * You should have received a copy of the GNU General Public License
  44.  * along with this program; if not, write to the Free Software
  45.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  46.  * ------------------------------------------------------------------------
  47.  */
  48.  
  49. /* Begin compatibility grunge  */
  50.  
  51. #if defined(__STDC__) || defined(WIN32) || defined(_amigados)
  52. #define    P(args)    args
  53. typedef void *VOIDSTAR;
  54. #else
  55. #define P(args)        ()
  56. typedef char *VOIDSTAR;
  57. #endif
  58.  
  59. #ifdef WIN32
  60. typedef char Boolean;
  61. typedef char *String;
  62. #define popen _popen
  63. #define pclose _pclose
  64.  
  65. #else
  66. #ifdef _amigados        /*  It is important, that these types have  */
  67. typedef int Boolean;    /*  a length of 4 bytes each, as we are     */
  68. typedef char *String;   /*  using ReadArgs() for argument parsing.  */
  69. #ifdef _DCC
  70. FILE *popen(const char *, const char *);
  71. int pclose(FILE *);
  72. #endif
  73.  
  74. #else
  75. #include <X11/Intrinsic.h>
  76. #endif
  77. #endif
  78.  
  79.  
  80. #ifndef TRUE
  81. #define TRUE 1
  82. #define FALSE 0
  83. #endif
  84.  
  85. /* End compatibility grunge */
  86.  
  87.  
  88. #define BOARD_SIZE        8
  89. #define LARGE_SQUARE_SIZE    80
  90. #define MEDIUM_SQUARE_SIZE    64
  91. #define SMALL_SQUARE_SIZE       40
  92. #define LARGE_LINE_GAP        3
  93. #define MEDIUM_LINE_GAP        3
  94. #define SMALL_LINE_GAP        2
  95. #define MAX_MOVES        512
  96. #define MSG_SIZ            256
  97. #define DIALOG_SIZE        256
  98. #define STAR_MATCH_N            16
  99. #define MOVE_LEN        32
  100. #define TIME_CONTROL        "5"    /* in minutes */
  101. #define TIME_DELAY_QUOTE    "1.0"    /* seconds between moves */
  102. #define TIME_DELAY              ((float) 1.0)
  103. #define MOVES_PER_SESSION    40    /* moves per TIME_CONTROL */
  104. #define WhiteOnMove(move)    (((move) % 2) == 0)
  105. #define ICS_HOST                "chess.lm.com"
  106. #define ICS_PORT            "5000"
  107. #define ICS_COMM_PORT           ""
  108. #define FIRST_HOST        "localhost"
  109. #define SECOND_HOST        "localhost"
  110. #define TELNET_PROGRAM          "telnet"
  111. #define MATCH_MODE        "False"
  112. #define INIT_STRING        "new\nbeep\nrandom\neasy\n"
  113. #define WHITE_STRING        "white\ngo\n"
  114. #define BLACK_STRING        "black\ngo\n"
  115. #define DEFAULT_SIZE            "Large"
  116. #define WHITE_PIECE_COLOR    "#FFFFCC"
  117. #define BLACK_PIECE_COLOR    "#202020"
  118. #define LIGHT_SQUARE_COLOR    "#C8C365"
  119. #define DARK_SQUARE_COLOR    "#77A26D"
  120. #define BELLCHAR                '\007'
  121. #define NULLCHAR                '\000'
  122.  
  123. typedef enum {
  124.     BeginningOfGame, MachinePlaysWhite, MachinePlaysBlack, TwoMachinesPlay,
  125.     EditGame, PlayFromGameFile, EndOfGame, EditPosition,
  126.     IcsIdle, IcsPlayingWhite, IcsPlayingBlack, IcsObserving,
  127.     IcsExamining
  128.   } GameMode;
  129.  
  130. typedef enum {
  131.     WhitePawn, WhiteRook, WhiteKnight, WhiteBishop, WhiteQueen, WhiteKing,
  132.     BlackPawn, BlackRook, BlackKnight, BlackBishop, BlackQueen, BlackKing,
  133.     EmptySquare,
  134.     ClearBoard, WhitePlay, BlackPlay /*for use on EditPosition menus*/
  135.   } ChessSquare;
  136.  
  137. typedef ChessSquare Board[BOARD_SIZE][BOARD_SIZE];
  138.  
  139. typedef enum {
  140.     WhiteKingSideCastle = 1, WhiteQueenSideCastle,
  141.     WhiteKingSideCastleWild, WhiteQueenSideCastleWild,
  142.     WhitePromotionKnight, WhitePromotionBishop,
  143.     WhitePromotionRook, WhitePromotionQueen,
  144.     BlackPromotionKnight, BlackPromotionBishop,
  145.     BlackPromotionRook, BlackPromotionQueen,
  146.     BlackKingSideCastle, BlackQueenSideCastle,
  147.     BlackKingSideCastleWild, BlackQueenSideCastleWild,
  148.     WhiteCapturesEnPassant, BlackCapturesEnPassant, NormalMove,
  149.     WhiteWins, BlackWins, GameIsDrawn, GameUnfinished,
  150.     GNUChessGame, XBoardGame, MoveNumberOne, 
  151.     BadMove, Comment, AmbiguousMove, PositionDiagram, ElapsedTime, PGNTag
  152.   } ChessMove;
  153.  
  154. typedef struct {
  155. #if !defined(_amigados)
  156.     char *whitePieceColor;
  157.     char *blackPieceColor;
  158.     char *lightSquareColor;
  159.     char *darkSquareColor;
  160. #else
  161.     int whitePieceColor;
  162.     int blackPieceColor;
  163.     int lightSquareColor;
  164.     int darkSquareColor;
  165. #endif
  166.     int movesPerSession;
  167.     char *initString;
  168.     char *whiteString;
  169.     char *blackString;
  170.     char *firstChessProgram;
  171.     char *secondChessProgram;
  172.     Boolean noChessProgram;
  173.     char *firstHost;
  174.     char *secondHost;
  175.     char *bitmapDirectory;
  176.     char *remoteShell;
  177.     char *remoteUser;
  178.     float timeDelay;
  179.     char *timeControl;
  180.     Boolean icsActive;
  181.     char *icsHost;
  182.     char *icsPort;
  183.     char *icsCommPort;  /* if set, use serial port instead of tcp host/port */
  184.     char *icsLogon;     /* Hack to permit variable logon scripts. */
  185.     Boolean useTelnet;
  186.     char *telnetProgram;
  187.     char *gateway;
  188.     char *loadGameFile;
  189.     int loadGameIndex;      /* game # within file */
  190.     char *saveGameFile;
  191.     Boolean autoSaveGames;
  192.     char *loadPositionFile;
  193.     int loadPositionIndex;  /* position # within file */
  194.     char *savePositionFile;
  195.     Boolean matchMode;
  196.     Boolean monoMode;
  197.     Boolean debugMode;
  198.     Boolean clockMode;
  199.     char *boardSize;
  200.     Boolean Iconic;
  201.     char *searchTime;
  202.     int searchDepth;
  203.     Boolean showCoords;
  204.     char *clockFont;
  205.     char *messageFont;
  206.     char *coordFont;
  207.     Boolean ringBellAfterMoves;
  208.     Boolean autoCallFlag;
  209.     Boolean flipView;
  210.     char *cmailGameName;
  211.     Boolean alwaysPromoteToQueen;
  212.     Boolean oldSaveStyle;
  213.     Boolean quietPlay;
  214.     Boolean showThinking;
  215.     Boolean autoObserve;
  216.     Boolean autoComment;
  217. /**** These are used only by xboard: ********/
  218.     int borderXoffset;
  219.     int borderYoffset;
  220.     Boolean titleInWindow;
  221. /********************************************/
  222. /**** Currently used only by WinBoard: ******/
  223.     Boolean localEdit;
  224. /********************************************/
  225.     Boolean zippyTalk;
  226.     Boolean zippyPlay;
  227. } AppData, *AppDataPtr;
  228.  
  229. extern AppData appData;
  230.  
  231. typedef struct {
  232.     /* PGN 7-tag info */
  233.     char *event;
  234.     char *site;
  235.     char *date;
  236.     char *round;
  237.     char *white;
  238.     char *black;
  239.     ChessMove result;
  240.     /* Additional info */
  241.     char *fen;          /* NULL or FEN for starting position; input only */
  242.     char *resultDetails;
  243.     char *timeControl;
  244.     char *extraTags;    /* NULL or "[Tag \"Value\"]\n", etc. */
  245. } GameInfo;
  246.  
  247.  
  248.